/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Service;

import DAO.CodigoDAO;
import DAO.DAOFactory;
import Entidad.Codigo;
import VO.CodigoVO;
import javax.persistence.EntityManager;

/**
 *
 * @author David
 */
public class CodeServices {
    
    public CodigoVO readCode(String code, EntityManager em) {
        CodigoDAO codeDAO = (CodigoDAO)DAOFactory.createDAO(DAOFactory.CODIGO);
        Codigo entity = codeDAO.findCodigo(code, em);
        if(entity != null) {
           CodigoVO vo =  entity.toVO();
           return vo;
        }
        else {
            return null;
        }
    }
    
    
    public void createCode(CodigoVO vo, EntityManager em) {
    }
    
    public void deleteCode(String code, EntityManager em) {
    }
    
    public void updateCode(CodigoVO vo, EntityManager em) {
    }
}
